package StudyCode.summary.mycollection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.ListIterator;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class UseAnEmptyListIterator {
	public static ListIterator<String> returnEmptyListIterator() {
		boolean someConditionMet = false;
		if (someConditionMet) {
			ArrayList<String> list = new ArrayList<>();
			ListIterator<String> listIterator = list.listIterator();
			return listIterator;
		} else {
			return Collections.emptyListIterator();
		}
	}

	public static void main(String[] args) {
		ListIterator<String> list = returnEmptyListIterator();
		System.out.println("空的 ListIterator:" + list);
		while (list.hasNext()) {
			String item = list.next();
			System.out.println(item);
		}
	}

}
